<template>
  <el-dialog v-model="dialogVisible" :destroy-on-close="true" width="60%" :title="dialogProps.title">
    <div class="dialog-content">
      <img v-for="item in imgs" :key="item.imgname" class="w100" :src="item.imgpath" />
    </div>
  </el-dialog>
</template>

<script setup lang="ts" name="SeatCodeDialog">
import { ref } from "vue";

interface DialogProps {
  title: string;
  isView: boolean;
  id?: number;
  typeId: number;
  api?: (params: any) => Promise<any>;
  getTableList?: () => void;
}

const dialogVisible = ref(false);
const imgs = ref([]);
const dialogProps = ref<DialogProps>({
  isView: false,
  regData: [],
  typeId: 0,
  id: 0,
  title: "",
  row: {}
});

// 接收父组件传过来的参数
const acceptParams = (params: DialogProps) => {
  dialogProps.value = params;
  dialogProps.value.api({ typeId: dialogProps.value.typeId, id: dialogProps.value.id }).then(res => {
    imgs.value = res.data.data;
  });
  dialogVisible.value = true;
};

defineExpose({
  acceptParams
});
</script>
<style lang="scss" scoped>
.dialog-content {
  height: 600px;
  overflow: scroll;
}
</style>
